//
//  ADWebViewController.m
//  MagazineShangejie
//
//  Created by wen on 15/11/9.
//  Copyright © 2015年 CnbizMedia. All rights reserved.
//

#import "ADWebViewController.h"
#import "Util.h"
@interface ADWebViewController ()<UIWebViewDelegate>

@property (weak, nonatomic) IBOutlet UIWebView *adWebView;
@end

@implementation ADWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
     NSURL *url = [[NSURL alloc]initWithString:[UserDefaults objectForKey:@"AdvertisementWebsite" ]];
    [_adWebView loadRequest:[NSURLRequest requestWithURL:url]];
    
 
    
    UIButton *buttonf=[UIButton buttonWithType:UIButtonTypeCustom];
    [buttonf setFrame:CGRectMake(0, 0, 22, 22)];
    [buttonf addTarget:self action:@selector(popOfDismss) forControlEvents:UIControlEventTouchUpInside];
    [buttonf setImage:[UIImage imageNamed:@"dismiss"] forState:UIControlStateNormal];
    UIBarButtonItem*leftBarItem = [[UIBarButtonItem alloc]initWithCustomView:buttonf];
    self.navigationItem.leftBarButtonItem=leftBarItem;

}



-(void)popOfDismss{
    
    //    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    //    NSInteger number = [userDefault integerForKey:@"underBarShow"];
    //
    //    if (number == 1) {
    //设置通知，显示tabbar
//    [[NSNotificationCenter defaultCenter] postNotificationName:@"showBootomBar" object:self userInfo:nil ];
    
    //    }
    
    //设置通知，广告显示完毕，跳转到主界面
//    [[NSNotificationCenter defaultCenter] postNotificationName:@"showTheNews" object:self userInfo:nil ];

    
//    if ([[self.navigationController viewControllers] count]>=1) {
//        //        self.hidesBottomBarWhenPushed = NO;
//        [self.navigationController popViewControllerAnimated:YES];
//        
//    }
//    else{
        //        self.hidesBottomBarWhenPushed = NO;
        [self dismissViewControllerAnimated:YES completion:nil];
//    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)closeButtonEvent:(id)sender {
    NSLog(@"sb");
}

@end
